/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bean;

import business.PackageTypeBusiness;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import model.PackageType;

/**
 *
 * @author Administrator
 */
@ManagedBean
@RequestScoped
public class MngPackageTypeBean {
    private PackageTypeBusiness business = new PackageTypeBusiness();
    private PackageType packType;
    private List<PackageType> listPackageType;

    public PackageType getPackType() {
        return packType;
    }

    public void setPackType(PackageType packType) {
        this.packType = packType;
    }
    
    public List<PackageType> getListPackageType() {
        return listPackageType;
    }

    public void setListPackageType(List<PackageType> listPackageType) {
        this.listPackageType = listPackageType;
    }

    public String updateTypeAction(PackageType pType){
        business.updatePackageType(pType);
        return "managementpackagetype.xhtml";
    }

    public String addNewTypeAction(){
        business.newPackageType(packType);
        listPackageType = business.listAllPackageType();
        return "managementpackagetype.xhtml";
    }
    /** Creates a new instance of MngPackageTypeBean */
    public MngPackageTypeBean() {
        packType = new PackageType();
        listPackageType = business.listAllPackageType();
    }

}
